package netTrackerGUI;

public class KeyPressedThread implements Runnable {

	String key;
	TrackerPanel trackerPanel;
	
	public KeyPressedThread(String key, TrackerPanel trackerPanel){
		this.key = key;
		this.trackerPanel = trackerPanel;
	}

	public void run() {
		String note = KeyMapper.lookup(key);	// Look up key in key mapper
		if (note != null){						// if mapping exists:
			trackerPanel.getSelectedCell().setNoteName(note); // set the note
			trackerPanel.netTracker.broadcastNoteEntry(trackerPanel.getSelectedCell().getCell().getNote(), 
						trackerPanel.getSelectedCell().toString()); // tell everybody
		}
	}

}
